package com.yy.main.app.service.impl;

import com.yy.main.app.mapper.TPermissionMapper;
import com.yy.main.app.service.IPermissionService;
import com.yy.pojo.base.TPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统菜单表服务实现类
 * </p>
 *
 * @author 杨阳
 * @since 2017-08-22
 */
@Service(value = "iPermissionService")
public class PermissionServiceImpl implements IPermissionService {

    private TPermissionMapper tPermissionMapper;

    @Autowired
    public PermissionServiceImpl(TPermissionMapper tPermissionMapper) {
        this.tPermissionMapper = tPermissionMapper;
    }

    @Override
    public List<TPermission> getUserPermissions(String userid) {
        return tPermissionMapper.getUserPermissions(userid);
    }

    @Override
    public List<String> getUserPerAuthentication(String userid) {
        return tPermissionMapper.getUserPerAuthentication(userid); // TODO 需要加缓存
    }

    @Override
    public List<TPermission> getUserPersManageTree(String id, String userid) {
        return tPermissionMapper.getUserPersManageTree(id, userid);
    }

    @Override
    public List<TPermission> roleAlreadyHavePermissions(String id, String roleid) {
        return tPermissionMapper.roleAlreadyHavePermissions(id, roleid);
    }

}
